<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改供应商订单')" />
    <th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-order-edit" th:object="${supplierOrder}">
            <input name="id" th:field="*{id}" type="hidden">
            <div class="form-group">    
                <label class="col-sm-3 control-label">供应商ID：</label>
                <div class="col-sm-8">
                    <input name="supplierId" th:field="*{supplierId}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">购煤数量：</label>
                <div class="col-sm-8">
                    <input name="amount" th:value="${@fmt.formatDecimal('__${supplierOrder.amount}__')}" class="form-control number decimal" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">购煤金额：</label>
                <div class="col-sm-8">
                    <input name="money" th:value="${@fmt.formatDecimal('__${supplierOrder.money}__')}" class="form-control number decimal" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">地址：</label>
                <div class="col-sm-8">
                    <input name="address" th:field="*{address}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">订单状态，0：未付款，1：已付款，2：已发货，3：已收货：</label>
                <div class="col-sm-8" th:with="type=${@dict.getType('order_status')}">
                    <label th:each="dict : ${type}" class="check-box">
                        <input name="status" type="checkbox" th:value="${dict.dictValue}" th:text="${dict.dictLabel}" th:attr="checked=${supplierOrder.status.contains(dict.dictValue)?true:false}">
                    </label>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">付款时间：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <input name="payTime" th:value="${#dates.format(supplierOrder.payTime, 'yyyy-MM-dd')}" class="form-control" placeholder="年-月-日" type="text">
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">发货时间：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <input name="deliverTime" th:value="${#dates.format(supplierOrder.deliverTime, 'yyyy-MM-dd')}" class="form-control" placeholder="年-月-日" type="text">
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">收货时间：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <input name="confirmTime" th:value="${#dates.format(supplierOrder.confirmTime, 'yyyy-MM-dd')}" class="form-control" placeholder="年-月-日" type="text">
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                    </div>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: datetimepicker-js" />
    <script th:inline="javascript">
        var prefix = ctx + "jjm/order";
        $("#form-order-edit").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/edit", $('#form-order-edit').serialize());
            }
        }

        $("input[name='payTime']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });

        $("input[name='deliverTime']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });

        $("input[name='confirmTime']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });
    </script>
</body>
</html>